1. /* srfrrdiv.cpp by K.Tsuru */
  2. // function ID = 813 BRADIX
  3. /*****************
  4. SRational class
  5. operator x/y
  6. (x.num/x.den) x.num * y.den
  7. --------------=---------------
  8. (y.num/y.den) x.den * y.num
  9. *****************/
  10. #ifndef SN_H
  11. #include "sn.h"
  12. #endif
  13. SRational RRDiv(const SRational& x, const SRational& y){
  14. if(y.Sign(813) == 0) x.num.SetError(x.num.DIVIDED_BY_ZERO,"SR /", 813);
  15. SRational z; // z.reduceDone = false;
  16. if((&x == &y) || (x == y)) z.SetLong(1, 1); // x/x
  17. else if(x.Sign(813) == 0) z.SetZero();
  18. else {
  19. z.num = x.num*y.den; z.den = x.den*y.num;
  20. z.reduce(false);
  21. }
  22. return z;
  23. }

srfrrdiv.cpp : last modifiled at 2016/06/26 16:27:16(628 bytes)
created at 2016/06/26 15:57:35
The creation time of this html file is 2016/09/18 20:28:04 (Sun Sep 18 20:28:04 2016).